/*program from Wolfycz*/
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x7f7f7f7f
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
inline char gc(){
    static char buf[1000000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
inline int frd(){
    int x=0,f=1; char ch=gc();
    for (;ch<'0'||ch>'9';ch=gc())   if (ch=='-')    f=-1;
    for (;ch>='0'&&ch<='9';ch=gc()) x=(x<<3)+(x<<1)+ch-'0';
    return x*f;
}
inline int read(){
    int x=0,f=1; char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar())  if (ch=='-')    f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar())    x=(x<<3)+(x<<1)+ch-'0';
    return x*f;
}
inline void print(int x){
    if (x<0)    putchar('-'),x=-x;
    if (x>9)    print(x/10);
    putchar(x%10+'0');
}
const int N=2e3;
char map[N+10][N+10];
int sum[N+10][N+10],lne[N+10][N+10],row[N+10][N+10];
int main(){
	freopen("unicom.in","r",stdin);
	freopen("unicom.out","w",stdout);
    int n=read(),m=read(),q=read();
    for (int i=1;i<=n;i++){
        scanf("%s",map[i]+1);
        for (int j=1;j<=m;j++){
            if (map[i][j]=='1'){
                sum[i][j]=1;
                if (map[i][j-1]=='1')   lne[i][j]=1;
                if (map[i-1][j]=='1')   row[i][j]=1;
            }
        }
    }
    for (int i=1;i<=n;i++){
        for (int j=1;j<=m;j++){
            sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
            lne[i][j]+=lne[i-1][j]+lne[i][j-1]-lne[i-1][j-1];
            row[i][j]+=row[i-1][j]+row[i][j-1]-row[i-1][j-1];
        }
    }
    for (int i=1;i<=q;i++){
        int x1=read(),y1=read(),x2=read(),y2=read(),Ans=0;
        Ans+=sum[x2][y2]-sum[x1-1][y2]-sum[x2][y1-1]+sum[x1-1][y1-1];
        Ans-=lne[x2][y2]-lne[x1-1][y2]-lne[x2][y1]+lne[x1-1][y1];
        Ans-=row[x2][y2]-row[x1][y2]-row[x2][y1-1]+row[x1][y1-1];
        printf("%d\n",Ans);
    }
    return 0;
}

